﻿using System.Data;
using System.Diagnostics;
using System.Web.UI;
using System.Web.UI.WebControls;
using AutoMapper;
using H2.NET.Common;
using H2.NET.Data.Common;
using H2.NET.Web.Management.Config.Service;
using H2.NET.Web.Pages.SMD.Helper;
using H2.NET.Web.Pages.SMD.Model;
using H2.NET.Web.Pages.SMD.Service;
using System.Linq;
using System;
using System.Collections.Generic;
using H2.NET.Web.Workflow.DwzCode;
using H2.NET.Web.Workflow.Helper;

namespace H2.NET.Web.Pages.SMD
{
    public partial class StoreDetail : BasePage
    {
        public DataTable deviceStatus
        {
            get
            {
                return ViewState["deviceStatus"] == null ? new DataTable() : ViewState["deviceStatus"] as DataTable;
            }
            set
            {
                ViewState["deviceStatus"] = value;
            }
        }

        public DataTable deviceContractSN
        {
            get
            {
                return ViewState["deviceContractSN"] == null ? new DataTable() : ViewState["deviceContractSN"] as DataTable;
            }
            set
            {
                ViewState["deviceContractSN"] = value;
            }
        }


        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                DataBind();
            }
        }

        private void DataBind()
        {
            try
            {
                var storeid = AksRequest.GetQueryString("storeId");

                var store = (t_smd_Store._StoreID == storeid).ListFirst<t_smd_Store>(Storage.Context3);

                if (store == null) return;

                #region 初始化控件

                InitControl(store);

                #endregion

                #region 经销商

                uc_dealer1.dealer = DealerService.GetById(store.DealerID.Value);
                uc_dealer1.IsReadonly = true;
                uc_dealer1.IsCanEditAuthID = false;

                #endregion

                #region 门店

                Title = "[" + store.AuthID + "]" + store.StoreName;

                StoreID.Value = store.StoreID.ToString();
                authid.Text = store.AuthID;
                StoreName.Text = store.StoreName;
                StoreStatus.SelectedValue = store.StoreStatus;
                StoreType.SelectedValue = StoreService.GetStoreTypeCode(store.StoreType);
                Channel.SelectedValue = store.Channel;
                FirstStartDate.Text = store.FirstStartDate == null
                    ? ""
                    : store.FirstStartDate.Value.ToString("yyyy-MM-dd");
                CurrentStartDate.Text = store.CurrentStartDate == null
                    ? ""
                    : store.CurrentStartDate.Value.ToString("yyyy-MM-dd");
                Region.Text = store.Region;
                Province.Text = store.Province;
                CityName.SelectedValue = store.CityName;
                Address.Text = store.StoreAddress;
                ContractPerson.Text = store.ContactPerson;
                PhoneNumber.Text = store.PhoneNumber;
                StoreSize.Text = store.StoreSize.ToString();
                AccountCMS.Text = store.AccountCMS;
                IsTintingService.Checked = store.IsTintingService == true;
                IsColourService.Checked = store.IsColourService == true;
                ShowInWebsite.Checked = store.ShowInWebsite == true;
                CloseDate.Text = store.CloseDate == null ? "" : store.CloseDate.Value.ToString("yyyy-MM-dd");
                CloseReason.Text = store.CloseReason;
                EapproveSN.Text = store.EapproveSN;
                StoreApprovedDate.Text = store.StoreApprovedDate == null
                    ? ""
                    : store.StoreApprovedDate.Value.ToString("yyyy-MM-dd");
                MallName.Text = store.MallName;
                MallShortName.Text = store.MallShortName;
                ShopSeq.Text = store.ShopSeq;
                HouseNumber.Text = store.HouseNumber;
                OpenBusinessDate.Text = store.OpenBusinessDate == null
                    ? ""
                    : store.OpenBusinessDate.Value.ToString("yyyy-MM");
                NewFitment.SelectedValue = store.NewFitment;
                IsUpgraded.Checked = store.IsUpgraded == true;
                if (IsUpgraded.Checked) BeforeUpgradedType.SelectedValue = store.BeforeUpgradedType;
                IsDowngraded.Checked = store.IsDowngraded == true;
                if (IsDowngraded.Checked) BeforeDowngradedType.SelectedValue = store.BeforeDowngradedType;
                IsRenew.Checked = store.IsRenew == true;
                if (IsRenew.Checked) BeforeRenewType.SelectedValue = store.BeforeRenewType;
                LastRenewDate.Text = store.LastRenewDate == null
                    ? ""
                    : store.LastRenewDate.Value.ToString("yyyy-MM-dd");

                #endregion

                #region 门店合同

                var contract = (t_smd_Contract._StoreID == store.StoreID).ListFirst<t_smd_Contract>(
                    Storage.Context3, " ContractID desc");
                if (contract != null)
                {
                    StoreContractSN.SelectedValue = contract.StoreContractSN;
                    StoreAffiliation.Text = contract.StoreAffiliation;
                    StoreContractBeginDate.Text = contract.StoreContractBeginDate == null
                        ? ""
                        : contract.StoreContractBeginDate.Value.ToString("yyyy-MM-dd");
                    StoreArchive.Text = contract.StoreArchive;
                    TransferFromStoreSN.Text = contract.TransferFromStoreSN;
                    TransferContractDate.Text = contract.TransferContractDate == null
                        ? ""
                        : contract.TransferContractDate.Value.ToString("yyyy-MM-dd");
                    StoreNotSignReason.Text = contract.StoreNotSignReason;
                    StoreNature.Text = contract.StoreNature;
                }
                else
                {
                    StoreContract.Visible = false;
                }

                #endregion

                #region 设备、设备合同

                var devices = (t_smd_Device._StoreID == storeid).List<t_smd_Device>(Storage.Context3).ToList();

                var deviceContracts =
                    (t_smd_ContractDevice._DeviceID.In(devices.Select(t => t.DeviceID))).List<t_smd_ContractDevice>(
                        Storage.Context3).ToList();

                if (devices.Count == 0)
                {
                    tb_device.Visible = false;
                }
                else
                {
                    rpt_devices.DataSource = devices;
                    rpt_devices.DataBind();

                    rpt_devices_contract.DataSource = deviceContracts;
                    rpt_devices_contract.DataBind();
                }

                #endregion
            }
            catch (Exception ex)
            {
                Logging.GetLogger().Error("======StoreDetail.aspx ---> DataBind st======");
                Logging.GetLogger().Error(ex);
                Logging.GetLogger().Error("======StoreDetail.aspx ---> DataBind ed======");
            }
        }

        private void InitControl(t_smd_Store store)
        {
            var configService = new ConfigService();

            #region 门店类型
            DataTable dt_area = configService.GetList("ParentId = (select configid from t_smd_Config where code='S_MDLX') order by seq").Tables[0];
            StoreType.AppendDataBoundItems = true;
            StoreType.Items.Add(new ListItem("==请选择==", ""));
            foreach (DataRow row in dt_area.Rows)
            {
                StoreType.Items.Add(new ListItem(row["Name"].ToString(), row["Value"].ToString()));
            }
            BeforeUpgradedType.AppendDataBoundItems = true;
            BeforeUpgradedType.Items.Add(new ListItem("==请选择==", ""));
            foreach (DataRow row in dt_area.Rows)
            {
                BeforeUpgradedType.Items.Add(new ListItem(row["Name"].ToString(), row["Value"].ToString()));
            }
            BeforeDowngradedType.AppendDataBoundItems = true;
            BeforeDowngradedType.Items.Add(new ListItem("==请选择==", ""));
            foreach (DataRow row in dt_area.Rows)
            {
                BeforeDowngradedType.Items.Add(new ListItem(row["Name"].ToString(), row["Value"].ToString()));
            }
            BeforeRenewType.AppendDataBoundItems = true;
            BeforeRenewType.Items.Add(new ListItem("==请选择==", ""));
            foreach (DataRow row in dt_area.Rows)
            {
                BeforeRenewType.Items.Add(new ListItem(row["Name"].ToString(), row["Value"].ToString()));
            }
            #endregion

            #region 门店状态
            DataTable dt_storeStatus = configService.GetList("ParentId = (select configid from t_smd_Config where code='S_MDZT') order by seq").Tables[0];
            StoreStatus.AppendDataBoundItems = true;
            StoreStatus.Items.Add(new ListItem("==请选择==", ""));
            foreach (DataRow row in dt_storeStatus.Rows)
            {
                StoreStatus.Items.Add(new ListItem(row["Name"].ToString(), row["Name"].ToString()));
            }

            #endregion

            #region 渠道
            DataTable dt_channel = configService.GetList("ParentId = (select configid from t_smd_Config where code='S_QD') order by seq").Tables[0];
            Channel.AppendDataBoundItems = true;
            Channel.Items.Add(new ListItem("==请选择==", ""));
            foreach (DataRow row in dt_channel.Rows)
            {
                Channel.Items.Add(new ListItem(row["Name"].ToString(), row["Name"].ToString()));
            }
            #endregion

            #region 城市

            DataTable dt_city =
                configService.GetList("ParentID = (select configid from [t_smd_Config] where [level] = 2 and value = '" + store.Province +
                                      "') order by seq asc").Tables[0];
            CityName.AppendDataBoundItems = true;
            CityName.Items.Add(new ListItem("==请选择==", ""));
            foreach (DataRow row in dt_city.Rows)
            {
                CityName.Items.Add(new ListItem(row["Name"].ToString(), row["Name"].ToString()));
            }
            #endregion

            #region 渠道
            DataTable dt_NewFitment = configService.GetList("ParentId = (select configid from t_smd_Config where code='S_NewFitme') order by seq").Tables[0];
            NewFitment.AppendDataBoundItems = true;
            NewFitment.Items.Add(new ListItem("==请选择==", ""));
            foreach (DataRow row in dt_NewFitment.Rows)
            {
                NewFitment.Items.Add(new ListItem(row["Name"].ToString(), row["Name"].ToString()));
            }
            #endregion


            #region 门店合同版本号
            DataTable dt_StoreContractSN = configService.GetList("ParentId = (select configid from t_smd_Config where code='S_HTBBH') order by seq").Tables[0];
            StoreContractSN.AppendDataBoundItems = true;
            StoreContractSN.Items.Add(new ListItem("==请选择==", ""));
            foreach (DataRow row in dt_StoreContractSN.Rows)
            {
                StoreContractSN.Items.Add(new ListItem(row["Name"].ToString(), row["Name"].ToString()));
            }
            #endregion


            #region 设备状态
            DataTable dt_Status = configService.GetList("ParentId = (select configid from t_smd_Config where code='S_SBZT') order by seq").Tables[0];
            deviceStatus = dt_Status;
            #endregion

            #region 设备合同版本号
            DataTable dt_deviceContractSN = configService.GetList("ParentId = (select configid from t_smd_Config where code='S_SBBBH') order by seq").Tables[0];
            deviceContractSN = dt_deviceContractSN;
            #endregion
        }

        protected void rpt_devices_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            try
            {
                var Status = e.Item.FindControl("Status") as DropDownList;
                var IsTurnSolid = e.Item.FindControl("IsTurnSolid") as CheckBox;
                var hf_Status = e.Item.FindControl("hf_Status") as HiddenField;
                var hf_IsTurnSolid = e.Item.FindControl("hf_IsTurnSolid") as HiddenField;

                Status.AppendDataBoundItems = true;
                Status.Items.Add(new ListItem("==请选择==", ""));
                Status.DataSource = deviceStatus;
                Status.DataTextField = "Name";
                Status.DataValueField = "Value";
                Status.SelectedValue = hf_Status.Value;
                Status.DataBind();

                IsTurnSolid.Checked = hf_IsTurnSolid.Value == "True";
            }
            catch (Exception ex)
            {
                Logging.GetLogger().Error("======StoreDetail.aspx ---> rpt_devices_ItemDataBound st======");
                Logging.GetLogger().Error(ex);
                Logging.GetLogger().Error("======StoreDetail.aspx ---> rpt_devices_ItemDataBound ed======");
            }
        }

        protected void rpt_devices_contract_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            try
            {
                var DeviceContractSN = e.Item.FindControl("DeviceContractSN") as DropDownList;
                var hf_DeviceContractSN = e.Item.FindControl("hf_DeviceContractSN") as HiddenField;
                DeviceContractSN.AppendDataBoundItems = true;
                DeviceContractSN.Items.Add(new ListItem("==请选择==", ""));
                DeviceContractSN.DataSource = deviceContractSN;
                DeviceContractSN.DataTextField = "Name";
                DeviceContractSN.DataValueField = "Value";
                DeviceContractSN.SelectedValue = hf_DeviceContractSN.Value;
                DeviceContractSN.DataBind();
            }
            catch (Exception ex)
            {
                Logging.GetLogger().Error("======StoreDetail.aspx ---> rpt_devices_contract_ItemDataBound st======");
                Logging.GetLogger().Error(ex);
                Logging.GetLogger().Error("======StoreDetail.aspx ---> rpt_devices_contract_ItemDataBound ed======");
            }
        }


        protected void btn_submit_Click(object sender, EventArgs e)
        {
            try
            {
                var userId = UserAPI.UserFullName;
                Mapper.CreateMap<t_StoreDataChangeLog, t_smd_StoreDataChangeLog>();

                #region 门店信息

                var store = StoreService.GetSmdStoreById(Convert.ToInt32(StoreID.Value));

                //var newStore = store.CloneObject() as t_smd_Store;

                //Debug.Assert(newStore != null, "newStore != null");
                //newStore.AuthID = authid.Text;
                //newStore.StoreName = StoreName.Text;
                //newStore.StoreStatus = StoreStatus.SelectedValue;
                //newStore.StoreType = StoreType.SelectedValue;
                //newStore.Channel = Channel.SelectedValue;
                //newStore.FirstStartDate = Utils.StrToDateTimeN(FirstStartDate.Text);
                //newStore.CurrentStartDate = Utils.StrToDateTimeN(CurrentStartDate.Text);
                //newStore.Region = Region.Text;
                //newStore.Province = Province.Text;
                //newStore.CityName = CityName.SelectedValue;
                //newStore.StoreAddress = Address.Text;
                //newStore.ContactPerson = ContractPerson.Text;
                //newStore.PhoneNumber = PhoneNumber.Text;
                //newStore.StoreSize = Utils.StrToDecimal(StoreSize.Text, 0);
                //newStore.AccountCMS = AccountCMS.Text;
                //newStore.IsTintingService = IsTintingService.Checked;
                //newStore.IsColourService = IsColourService.Checked;
                //newStore.ShowInWebsite = ShowInWebsite.Checked;
                //newStore.CloseDate = Utils.StrToDateTimeN(CloseDate.Text);
                //newStore.CloseReason = CloseReason.Text;
                //newStore.EapproveSN = EapproveSN.Text;
                //newStore.StoreApprovedDate = Utils.StrToDateTimeN(StoreApprovedDate.Text);
                //newStore.MallName = MallName.Text;
                //newStore.MallShortName = MallShortName.Text;
                //newStore.ShopSeq = ShopSeq.Text;
                //newStore.HouseNumber = HouseNumber.Text;
                //newStore.OpenBusinessDate = Utils.StrToDateTimeN(OpenBusinessDate.Text);
                //newStore.NewFitment = NewFitment.SelectedValue;
                //newStore.IsUpgraded = IsUpgraded.Checked;
                //newStore.BeforeUpgradedType = IsUpgraded.Checked ? BeforeUpgradedType.SelectedValue : null;
                //newStore.IsDowngraded = IsDowngraded.Checked;
                //newStore.BeforeDowngradedType = IsDowngraded.Checked ? BeforeDowngradedType.SelectedValue : null;
                //newStore.IsRenew = IsRenew.Checked;
                //if (IsRenew.Checked)
                //{
                //    newStore.BeforeRenewType = BeforeRenewType.SelectedValue;
                //    newStore.LastRenewDate = Utils.StrToDateTimeN(LastRenewDate.Text);
                //}
                //else
                //{
                //    newStore.BeforeRenewType = null;
                //    newStore.LastRenewDate = null;
                //}


                //var storeChangelogs = DataHelper<t_smd_Store>.GetChangeLogs(store, newStore,
                //    newStore.GetChangeFields(), "StoreID", userId, "", "MaintainChangeStore");

                //var smdChangelogs =
                //    Mapper.Map<IList<t_StoreDataChangeLog>, List<t_smd_StoreDataChangeLog>>(storeChangelogs);
                //foreach (t_smd_StoreDataChangeLog smdChangelog in smdChangelogs)
                //{
                //    smdChangelog.EntityState._FieldState.Remove("LogID");
                //}
                //Storage.Save(Storage.Context3, smdChangelogs.ToArray());

                //newStore.EntityState._FieldState.Remove("StoreID");
                //newStore.EntityState._Loaded = true;
                //Storage.Save(Storage.Context3, newStore);

                #endregion

                #region 门店合同

                var contract = (t_smd_Contract._StoreID == store.StoreID).ListFirst<t_smd_Contract>(Storage.Context3, " ContractID desc");
                if (StoreContract.Visible)
                {
                    var newContract = contract.CloneObject() as t_smd_Contract;
                    Debug.Assert(newContract != null, "newContract != null");
                    newContract.StoreContractSN = StoreContractSN.SelectedValue;
                    newContract.StoreAffiliation = StoreAffiliation.Text;
                    newContract.StoreContractBeginDate = Utils.StrToDateTimeN(StoreContractBeginDate.Text);
                    newContract.StoreArchive = StoreArchive.Text;
                    newContract.TransferFromStoreSN = TransferFromStoreSN.Text;
                    newContract.TransferContractDate = Utils.StrToDateTimeN(TransferContractDate.Text);
                    newContract.StoreNotSignReason = StoreNotSignReason.Text;

                    var contractChangelogs = DataHelper<t_smd_Contract>.GetChangeLogs(contract, newContract,
                        newContract.GetChangeFields(), "ContractID", userId, "", "MaintainChangeContract");

                    var smdChangelogs =
                        Mapper.Map<IList<t_StoreDataChangeLog>, List<t_smd_StoreDataChangeLog>>(contractChangelogs);
                    foreach (t_smd_StoreDataChangeLog smdChangelog in smdChangelogs)
                    {
                        smdChangelog.EntityState._FieldState.Remove("LogID");
                    }
                    Storage.Save(Storage.Context3, smdChangelogs.ToArray());

                    newContract.EntityState._FieldState.Remove("ContractID");
                    newContract.EntityState._Loaded = true;
                    Storage.Save(Storage.Context3, newContract);
                }

                #endregion

                #region 设备

                //foreach (RepeaterItem item in rpt_devices.Items)
                //{
                //    var DeviceID = item.FindControl("DeviceID") as HiddenField;
                //    var Status = item.FindControl("Status") as DropDownList;
                //    var FullSetSN = item.FindControl("FullSetSN") as TextBox;
                //    var IsTurnSolid = item.FindControl("IsTurnSolid") as CheckBox;
                //    var DeliveryType = item.FindControl("DeliveryType") as TextBox;
                //    var PurchasedDate = item.FindControl("PurchasedDate") as TextBox;
                //    var InstallDate = item.FindControl("InstallDate") as TextBox;
                //    var DispenserModel = item.FindControl("DispenserModel") as TextBox;
                //    var DispenserFixedAsset = item.FindControl("DispenserFixedAsset") as TextBox;
                //    var DispenserSN = item.FindControl("DispenserSN") as TextBox;
                //    var ShakerModel = item.FindControl("ShakerModel") as TextBox;
                //    var ShakerFixedAsset = item.FindControl("ShakerFixedAsset") as TextBox;
                //    var ShakerSN = item.FindControl("ShakerSN") as TextBox;
                //    var PcModel = item.FindControl("PcModel") as TextBox;
                //    var PcFixedAsset = item.FindControl("PcFixedAsset") as TextBox;
                //    var PcSN = item.FindControl("PcSN") as TextBox;

                //    var device = DeviceService.GetSmdDeviceById(Convert.ToInt32(DeviceID.Value));
                //    var newDevice = device.CloneObject() as t_smd_Device;
                //    newDevice.Status = Status.SelectedValue;
                //    newDevice.FullSetSN = FullSetSN.Text;
                //    newDevice.IsTurnSolid = IsTurnSolid.Checked;
                //    newDevice.DeliveryType = DeliveryType.Text;
                //    newDevice.PurchasedDate = Utils.StrToDateTimeN(PurchasedDate.Text);
                //    newDevice.InstallDate = Utils.StrToDateTimeN(InstallDate.Text);
                //    newDevice.DispenserModel = DispenserModel.Text;
                //    newDevice.DispenserFixedAsset = DispenserFixedAsset.Text;
                //    newDevice.DispenserSN = DispenserSN.Text;
                //    newDevice.ShakerModel = ShakerModel.Text;
                //    newDevice.ShakerFixedAsset = ShakerFixedAsset.Text;
                //    newDevice.ShakerSN = ShakerSN.Text;
                //    newDevice.PcModel = PcModel.Text;
                //    newDevice.PcModel = PcModel.Text;
                //    newDevice.PcFixedAsset = PcFixedAsset.Text;
                //    newDevice.PcSN = PcSN.Text;

                //    var deviceChangelogs = DataHelper<t_smd_Device>.GetChangeLogs(device, newDevice,
                //    newDevice.GetChangeFields(), "DeviceID", userId, "", "MaintainChangeDevice");

                //    smdChangelogs =
                //        Mapper.Map<IList<t_StoreDataChangeLog>, List<t_smd_StoreDataChangeLog>>(deviceChangelogs);
                //    foreach (t_smd_StoreDataChangeLog smdChangelog in smdChangelogs)
                //    {
                //        smdChangelog.EntityState._FieldState.Remove("LogID");
                //    }
                //    Storage.Save(Storage.Context3, smdChangelogs.ToArray());

                //    newDevice.EntityState._FieldState.Remove("DeviceID");
                //    newDevice.EntityState._Loaded = true;
                //    Storage.Save(Storage.Context3, newDevice);
                //}
                #endregion

                #region 设备合同

                foreach (RepeaterItem item in rpt_devices_contract.Items)
                {
                    var ContractDeviceID = item.FindControl("ContractDeviceID") as HiddenField;
                    var DeviceContractSN = item.FindControl("DeviceContractSN") as DropDownList;
                    var DeviceAffiliation = item.FindControl("DeviceAffiliation") as TextBox;
                    var DeviceContractBeginDate = item.FindControl("DeviceContractBeginDate") as TextBox;
                    var DeviceArchive = item.FindControl("DeviceArchive") as TextBox;
                    var DeviceNotSignReason = item.FindControl("DeviceNotSignReason") as TextBox;

                    var contractDevice = ContractDeviceService.getContractDeviceByContractDeviceID(Convert.ToInt32(ContractDeviceID.Value));
                    var newContractDevice = contractDevice.CloneObject() as t_smd_ContractDevice;

                    newContractDevice.DeviceContractSN = DeviceContractSN.Text;
                    newContractDevice.DeviceAffiliation = DeviceAffiliation.Text;
                    newContractDevice.DeviceContractBeginDate = Utils.StrToDateTimeN(DeviceContractBeginDate.Text);
                    newContractDevice.DeviceArchive = DeviceArchive.Text;
                    newContractDevice.DeviceNotSignReason = DeviceNotSignReason.Text;

                    var contractDeviceChangelogs = DataHelper<t_smd_ContractDevice>.GetChangeLogs(contractDevice, newContractDevice,
                    newContractDevice.GetChangeFields(), "ContractDeviceID", userId, "", "MaintainChangeContractDevice");

                    var smdChangelogs =
                        Mapper.Map<IList<t_StoreDataChangeLog>, List<t_smd_StoreDataChangeLog>>(contractDeviceChangelogs);
                    foreach (t_smd_StoreDataChangeLog smdChangelog in smdChangelogs)
                    {
                        smdChangelog.EntityState._FieldState.Remove("LogID");
                    }
                    Storage.Save(Storage.Context3, smdChangelogs.ToArray());

                    newContractDevice.EntityState._FieldState.Remove("ContractDeviceID");
                    newContractDevice.EntityState._Loaded = true;
                    Storage.Save(Storage.Context3, newContractDevice);
                }

                #endregion

                ScriptManager.RegisterStartupScript(this, this.GetType(), "info_prompt",
                    "$.jBox.prompt('操作成功！','提示', 'info', { closed: function () { window.opener.reload(); closeWin(); } });",
                    true);
            }
            catch (Exception ex)
            {
                Logging.GetLogger().Error("======StoreDetail.aspx ---> btn_submit_Click st======");
                Logging.GetLogger().Error(ex);
                Logging.GetLogger().Error("======StoreDetail.aspx ---> btn_submit_Click ed======");

                ScriptManager.RegisterStartupScript(this, GetType(), "info_tip",
                    "$.jBox.prompt('" + ex + "','提示', 'info');", true);
            }
        }

    }

}